package threadProblem;
//sleep() 的使用
public class Test_4_19 {
    public static void main(String[] args) throws InterruptedException {
        //获取当前线程的引用
        Thread t = Thread.currentThread();
        System.out.println("当前线程的名字：" + t.getName());
        System.out.println();

        //线程休眠
        long begin = System.currentTimeMillis();
        System.out.println("休眠3000毫秒！");
        System.out.println(begin);
        //因系统随机调度，只能保证休眠的时间是大于等于3000毫秒
        Thread.sleep(2000);
        long end = System.currentTimeMillis();
        System.out.println(end);
        System.out.println(end - begin);
        System.out.println();

        //线程的状态
        System.out.println("打印线程的状态");
        for(Thread.State state : Thread.State.values()){
            System.out.println(state);
        }
    }
}
